import { http } from "@/utils/http";
import { UserModel } from "@/api/model/userModel";
import { PageResponse } from "@/api/model/baseModel";

enum Api {
  UserList = "/user/list",
  UserAdd = "/user/add",
}

export function userList(params: UserModel) {
  return http.get<PageResponse<UserModel>>({
    url: Api.UserList,
    params,
  });
}
export function addUser(params: UserModel) {
  return http.post<boolean>({
    url: Api.UserAdd,
    params,
  });
}
export function checkUsername(username: string) {
  return http.get<Boolean>({
    url: `/user/check/${username}`,
  });
}

export function deleteUser(id: string) {
  return http.post<string>({
    url: `/user/deleteUser/${id}`,
  });
}
